package com.ieds.web.controller;

import com.ieds.core.dto.BootTablePage;
import com.ieds.web.service.KDatabaseMonitorService;
import com.ieds.web.utils.JsonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: wanglei
 * @Date: 2020.05.27
 * @Description: com.ieds.web.controller
 * @version: 1.0
 */
@RestController
@RequestMapping("/database/monitor/")
public class DatabaseMonitorController {

    @Autowired
    private KDatabaseMonitorService kDatabaseMonitorService;
    /**
     * @param: []
     * @return: java.lang.String
     * @date: 2020.05.28 16:59
     * @Title：getAllMonitorMonitorSize
     * @Description 获取总数据源监控数
     */
    @RequestMapping("getAllDatabaseMonitorSize.shtml")
    public String getAllDatabaseMonitorSize() {
        return JsonUtils.objectToJson(kDatabaseMonitorService.getAllDatabaseMonitorSize());
    }

    /**
     * @param: []
     * @return: java.lang.String
     * @date: 2020.05.28 16:59
     * @Title：getAllMonitorMonitorSize
     * @Description 获取总数据源监控数
     */
    @RequestMapping("getList.shtml")
    public String getList(Integer offset, Integer limit, Integer databaseType, String databaseName) {
        BootTablePage list = kDatabaseMonitorService.getList(offset,limit,databaseType,databaseName);
        return JsonUtils.objectToJson(list);
    }

    /**
     * @param: []
     * @return: java.lang.String
     * @date: 2020.05.29 10:58
     * @Title：getAllSuccess
     * @Description 获取总成功次数
     */
    @RequestMapping("getAllSuccess.shtml")
    public String getAllSuccess(){
       return JsonUtils.objectToJson(kDatabaseMonitorService.getAllSuccess());
    }

    /**
     * @param: []
     * @return: java.lang.String
     * @date: 2020.05.29 11:27
     * @Title：getAllFail
     * @Description 获取总失败次数
     */
    @RequestMapping("getAllFail.shtml")
    public String getAllFail(){
        return JsonUtils.objectToJson(kDatabaseMonitorService.getAllFail());
    }
}
